// ----------------------------------
// RSDK Project: Sonic 1/Sonic 2
// Script Description: Fall Platform Object
// Script Author: Christian Whitehead/Simon Thomley
// Unpacked by Rubberduckycooly's script unpacker
// ----------------------------------

//-------Aliases-------//
private alias 47 : TYPE_SBZPlatform

// Function declarations
reserve function SBZPlatform_DebugDraw
reserve function SBZPlatform_DebugSpawn

// Static Values

// Tables

function SBZPlatform_DebugDraw
	DrawSprite(0)
end function


function SBZPlatform_DebugSpawn
	CreateTempObject(TypeName[GHZ Platform], 0, object.xpos, object.ypos)
	object[tempObjectPos].value3 = object[tempObjectPos].ypos
end function


event ObjectMain
	foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
		CheckEqual(object[0].state, PlayerObject_HandleMonikaTeleport)
		temp7 = checkResult
		CheckLower(object[0].value1, 20)
		temp7 &= checkResult
		if temp7 == 0			
			BoxCollisionTest(C_PLATFORM, object.entityPos, 0, 0, 64, 8, currentPlayer, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO)
		end if	
	next
end event


event ObjectDraw
	DrawSprite(0)
end event


event ObjectStartup
	LoadSpriteSheet("MBZ/Objects.gif")
	SpriteFrame(0, 0, 64, 14, 170, 295)
	//SpriteFrame(-32, -14, 64, 32, 50, 18)
	foreach (TypeName[SBZ Platform], arrayPos0, ALL_ENTITIES)
		object[arrayPos0].value3 = object[arrayPos0].ypos
	next
	SetTableValue(TypeName[GHZ Platform], DebugMode_ObjCount, DebugMode_TypesTable)
	SetTableValue(SBZPlatform_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)
	SetTableValue(SBZPlatform_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)
	DebugMode_ObjCount++
end event

event RSDKDraw
	DrawSprite(0)
end event

event RSDKLoad
	LoadSpriteSheet("Global/Display.gif")
	SpriteFrame(-16, -16, 32, 32, 1, 143)
end event
